//
//  HZUpdownLable.m
//  Stock_Stategy
//
//  Created by MayerF on 2017/11/27.
//  Copyright © 2017年 MayerF. All rights reserved.
//

#import "HZUpdownLable.h"

@interface HZUpdownLable()
@property (nonatomic, strong)UILabel *pUpLabel;
@property (nonatomic, strong)UILabel *pDownLabel;
@end

@implementation HZUpdownLable

#pragma mark -
#pragma mark 生命周期
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self initCommon];
        [self initConstraints];
    }
    return self;
}
- (void)initCommon
{
    _pUpLabel = [UILabel new];
    _pDownLabel = [UILabel new];
    
    _pUpLabel.textAlignment = NSTextAlignmentCenter;
    _pDownLabel.textAlignment = NSTextAlignmentCenter;
    _pUpLabel.textColor = kREDColor;
    _pDownLabel.textColor = kGRAYColor;
    _pUpLabel.font = [UIFont systemFontOfSize:19];
    _pDownLabel.font = [UIFont systemFontOfSize:14];
}
- (void)initConstraints
{
    [self addSubview:_pUpLabel];
    [self addSubview:_pDownLabel];
    
    [_pUpLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(self);
        make.bottom.mas_equalTo(_pDownLabel.mas_top);
    }];
    [_pDownLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.height.mas_equalTo(_pUpLabel);
        make.bottom.mas_equalTo(self);
    }];
}

- (void)setUptext:(NSString *)uptext downtext:(NSString *)donwtext
{
    [self setUptext:uptext];
    [self setDowntext:donwtext];
}
- (void)setUptext:(NSString *)uptext
{
    _pUpLabel.text = uptext;
}
- (void)setDowntext:(NSString *)downtext
{
    _pDownLabel.text = downtext;
}
- (void)setUpTextColor:(UIColor *)color
{
    _pUpLabel.textColor = color;
}

@end
